
import javafx.application.Application;
import javafx.stage.Stage;
import mule.presenter.StartScreenPresenter;

/**
 *
 * @author stephen
 */

import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import mule.presenter.StartScreenPresenter;

/**
 *
 * @author not stephen
 */
public class App extends Application 
{
    @Override
    public void start(Stage stage) throws Exception 
    {
        StartScreenPresenter startScreenPresenter = new StartScreenPresenter( stage );
        startScreenPresenter.present();
        stage.setOnCloseRequest( new EventHandler<WindowEvent>(){
            @Override
            public void handle(WindowEvent we) {
                Platform.exit();
                System.exit( 0 ); //oh dear god, the bad code, it hurts
            }
            
        } );
    }
    
    public static void main( String[] args ) throws InterruptedException
    {
        Thread t = new Thread( "Presenter Thread" )
        {
            public void run()
            {
                Application.launch( App.class, new String[0] );
            }
        };
        
        t.setDaemon( true );
        t.start();
    }
}

